package st.business.tepth.business.user.busnumber.workholder.maintain.work.content.standardwork;

import st.business.tepth.base.OnDataConvertListener;

/**
 * Author: shadow
 * Email:  1025431817@qq.com
 * Time:   2019-04-09 09:44
 */

public class StandardWorkPresenter extends StandardWorkContract.Presenter {
    private final StandardWorkContract.View mView;
    private final StandardWorkContract.Model mModel;

    public StandardWorkPresenter(StandardWorkContract.View view) {
        mView = view;
        mModel = new StandardWorkModel();
    }

    @Override
    void cancelWork(String token, int maintainId, final int position) {
        addDisposable(mModel.cancelWork(token, maintainId,
                new OnDataConvertListener<String>() {
                    @Override
                    public void convert(String workBean) {
                        mView.showCancelSucceed(position);
                    }

                    @Override
                    public void error(int code, String msg) {
                        mView.showError(msg);
                    }
                }));
    }
}
